package easy;

public class test5 {
    // https://leetcode.cn/problems/contains-duplicate-ii/submissions/681139496/
    /*
    public boolean containsNearbyDuplicate(int[] nums, int k) {
        HashMap<Integer,Integer> map=new HashMap<>();
        for(int i=0;i<nums.length;i++) {
            if(!map.containsKey(nums[i])) {    // 该元素第一次出现
                map.put(nums[i],i); // 将值和下标存进去
            } else {
                int index=map.get(nums[i]);
                int tmp=i-index;
                if(tmp<=k) return true;
                else map.put(nums[i],i);
            }
        }
        return false;
    }
     */
}
